<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>PANEO ARTICLES</title>
<%include file="_head.html"/>
<link href="/_paneo/common/css/datepicker.css" rel="stylesheet">
<script src="/_paneo/common/js/bootstrap-datepicker.js"></script>

<script src='/_paneo/common/js/jquery.autosize.js'></script>
<link rel="stylesheet" href="/_paneo/common/redactor/redactor.css" />
<script src="/_paneo/common/redactor/redactor.js"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$('.wysi').autosize();
//$('.wysi').redactor({ source: true,autoresize: true });
}
);
</script>

</head>
<body>

<div class="navbar navbar-fixed-top">

<%include file="_header.html" />

</div>

<div class="container-fluid">

<div class="row-fluid">

<div class="span2">
<!--Sidebar content-->
    <%include file="_sidebar.html" />
</div>
<div class="span10">
    <div id="content">
    <h1>
    ARTICLES ${article.title} 
    %if mode == 'view':
    <a href="/paneo/articles/${article.prefix}/new/" class="btn" style="margin-left:30px;">新しい記事の追加</a>
    %else:
    <a href="/paneo/articles/${article.prefix}/" class="btn" style="margin-left:30px;">一覧に戻る</a>
    %endif
    </h1>
    <form class="form-horizontal"  enctype="multipart/form-data" method="POST">

    <fieldset>
    <legend>ID:${post.id} ${ post.title } を 編集
    <a href="/article/${post.slug}.html" target="_blank" class="icon-share-alt">
    <span class="label">
    ページ表示
    </span>
    </a>
    </legend>

    %if web.ctx.get('MSG') :
    <br>
    <div class="label label-important">※${web.ctx.get('MSG')}</div>
    <br>
    %endif
    <div class="control-group">
    <label class="control-label" for="VIEWED">公開設定</label>
    <div class="controls">
    %for k,v in sorted(VIEWED.items()):
    <input type="radio" name="VIEWED" value="${k}" ${"checked" if k == str(post.viewed) else ""}>${v}
    %endfor
    </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="KEY">参照KEY</label>
        <div class="controls">
        <input type="text" class="input-xlarge span2" name="KEY" value="${post.key}">
        <div>※記事間の連動に利用します。</div>
        <div>[呼び出し例]</div>
        <pre>
${"<"}${"%"}${" posts = AT.GetPostsByKey('%s','%s')"%(post.article.prefix,post.key)}${" %"}${">"}
${"%for contents in posts:"}
${"$"}${"{"}${ "contents.title}" }
${"$"}${"{"}${ "contents.GetField('--paneo-name--')}" }
${"%endfor"}
        </pre>
        </div>
    </div>

    <div class="control-group">
    <label class="control-label" for="TITLE">記事タイトル</label>
    <div class="controls">
    <input type="text" name="TITLE" value="${ post.title }" style="font-size:1.3em;width:60%;">
    <br>
    ${"$"}${"{"}post.title${"}"}
    </div>
    </div>

    <div class="control-group">
    <label class="control-label" for="HEADER">段落ヘッダー文</label>
    <div class="controls">
    <input type="text" style="font-size:1.3em;width:60%;" name="HEADER" value="${post.header}">
    <br>
    ${"$"}${"{"}post.header${"}"}
    </div>
    </div>

    <div class="control-group">
    <label class="control-label" for="LEAD">段落リード文</label>
    <div class="controls">
    <textarea name="LEAD" style="width:85%;">${post.lead}</textarea>
    <br>
    ${"$"}${"{"}post.lead${"}"}
    </div>
    </div>

    <div class="control-group">
    <label class="control-label" for="DESCRIPTION">概要</label>
    <div class="controls">
    <input type="text" name="DESCRIPTION" value="${ post.description }" style="font-size:1.3em;width:95%;">
    </div>
    </div>
    <div class="control-group">
    <label class="control-label" for="KEYWORD">キーワード</label>
    <div class="controls">
    <input type="text" name="KEYWORD" value="${ post.keyword }" style="font-size:1.3em;width:95%;">
    </div>
    </div>

    <div class="row" style="margin:0 0 10px 110px;">
        <span class="label" for="date">公開日付</span>
        <div class="input-append date" id="date" data-date="${post.date.strftime("%Y-%m-%d")}" data-date-format="yyyy-mm-dd">
        <input name="DATE" type="text" value="${post.date.strftime("%Y-%m-%d")}" style="width:80px;" readonly>
        <span class="add-on"><i class="icon-th"></i></span>
        </div>
        <span class="label" style="margin-left:10px;">ファイル名</span>
        <input name="SLUG" type="text" value="${post.slug}" style="width:200px;">
        <span>.html</span>
        <span class="label" style="margin-left:10px;">編集パスワード</span>
        <input name="PASSWORD" type="text" value="${post.password}" style="width:100px;">
    </div>
    <br/>
    <!-- MENU TABS xx St -->
    <ul class="nav nav-tabs">
    <li ${ 'class="active"' if art_mode == 'template' else '' }>
    <a href="/paneo/articles/${prefix}/edit/ID${id}/template/"><i class="icon-book"></i> TEMPLATE</a>
    </li>
    <li ${ 'class="active"' if art_mode == 'category' else '' }>
    <a href="/paneo/articles/${prefix}/edit/ID${id}/category/"><i class="icon-th-list"></i>GROUP & CATEGORY</a>
    </li>
    <li ${ 'class="active"' if art_mode == 'contents' else '' }>
    <a href="/paneo/articles/${prefix}/edit/ID${id}/contents/"><i class="icon-pencil"></i> CONTENTS</a>
    </li>
    <li ${ 'class="active"' if art_mode == 'images' else '' }>
    <a href="/paneo/articles/${prefix}/edit/ID${id}/images/"><i class="icon-picture"></i> IMAGES</a>
    </li>
    <!--
    <li ${ 'class="active"' if art_mode == 'background' else '' }>
    <a href="/paneo/articles/${prefix}/edit/ID${id}/background/"><i class="icon-fullscreen"></i> BACKGROUND</a>
    </li>
    -->
    <li ${ 'class="active"' if art_mode == 'ecaws' else '' }>
    <a href="/paneo/articles/${prefix}/edit/ID${id}/ecaws/"><i class="icon-shopping-cart"></i> Amazon</a>
    </li>
    </ul>
    <!-- MENU TABS xx En -->
    <!-- Tempate xx St -->
    <%include file="articles_post_template.html"/>
    <!-- Tempate xx En -->

    <!-- Category xx St -->
    <%include file="articles_post_category.html"/>
    <!-- Category xx En -->

    <!-- Contents xx St -->
    %if art_mode == 'contents':
    <%include file="_contents.html"/>
    %endif
    <!-- Contents xx En -->

    <!-- Images xx St -->
    %if art_mode == 'images':
    <%include file="_images.html" />
    %endif
    <!-- Images xx En -->

    <!-- ECAWS xx St -->
    <%include file="articles_post_ecaws.html"/>
    <!-- ECAWS xx En -->

    <div class="form-actions">
        <button class="btn btn-primary" type="submit" name="COMMIT">更新する</button>
        <button class="btn" type="reset" style="margin-left:20px;">Cancel</button>
        %if post.viewed == 3 :
        <button class="btn btn-danger" name="CONTENTS_DELETE" style="margin-left:50%;">削除する</button>
        %endif
    </div>


    </fieldset>
    </form>
    </div><!--/div#content row span-->
</div>

</div><!--/row-->

</div><!--/container-fluid"-->

<hr>

<%include file="_footer.html" />

</div><!--/.fluid-container-->

<script>
$(function(){
$('#date').datepicker();
});
</script>

<script>
var editor = CodeMirror.fromTextArea(document.getElementById("HTMLTEMPLATE"), {
    mode: 'text/html',
    tabMode: 'indent',
    lineNumbers: true,
    matchBrackets: true,
    indentUnit: 4,
    smartIndent: false,
    indentWithTabs: true,
    enterMode: 'flat',
    lineWrapping: true,
});
</script>

</body>
</html>


